#include "iostream"
using namespace std;
int main(){
	int n;
	cin>>n;
	if(n<6){
		cout<<n-12;
	}else if(n>=6&&n<15){
		cout<<3*n-1;
	}else{
		cout<<5*n+9;
	}
	return 0;
}
